﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.IO.Compression;

namespace SelfHosting.Handlers.Compression
{
    /// <summary>
    /// Le HttpContent compressé
    /// </summary>
    public class CompressedContent : BaseContent
    {
        #region Constructeur

        /// <summary>
        /// Constructeur de la classe CompressedContent
        /// </summary>
        /// <param name="content">Le content original</param>
        /// <param name="compressor">Compresseur</param>
        public CompressedContent(HttpContent content, ICompressor compressor)
            : base(content, compressor)
        {
        }

        #endregion

        #region Méthodes

        /// <summary>
        /// Créatin du stream compressé
        /// </summary>
        /// <param name="stream">Stream à compresser</param>
        /// <returns>Stream compressé</returns>
        protected override Stream CreateStream(Stream stream)
        {
            return Compressor.CreateCompressionStream(stream);
        }

        #endregion
    }
}
